/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.agilelang.object;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;

/**
 *
 * @author Roderick
 */
public class ObjectFunction {

    /*public AgileFunction(String name ){
     this.name = name;
     }*/
    String name = "";

    List<ObjectParam> params = new ArrayList<>();

    public String getName() {
        return name;
    }

    @XmlAttribute
    public void setName(String name) {
        this.name = name;
    }

    public List<ObjectParam> getParams() {
        return params;
    }

    public void setParams(List<ObjectParam> params) {
        this.params = params;
    }

    public void addParam(ObjectParam param) {
        this.params.add(param);
    }

    public String getDefine(String key) {
        for (ObjectParam attr : params) {
            if (attr.getName().equals(key)) {
                return attr.getValue();
            }
        }
        return "";
    }
}
